package com.igeekhome.controller.api;

import com.igeekhome.pojo.BaseDict;
import com.igeekhome.util.ResultBean;
import com.igeekhome.util.TableResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Romeo
 */
@RestController
@RequestMapping("/api/shipmentType")
public class ShipmentTypeControllerApi {
    @Autowired
    private BaseDictControllerApi baseDictControllerApi;

    @Value("${SHIPMENT_TYPE}")
    private String SHIPMENT_TYPE;
    @Value("${SHIPMENT_NAME}")
    private String SHIPMENT_NAME;

    @RequestMapping("/list")
    public TableResultBean list(Integer page, Integer limit){
        baseDictControllerApi.setCode(SHIPMENT_TYPE);
        return baseDictControllerApi.list(page,limit);
    }
    @RequestMapping("/add")
    public ResultBean add(BaseDict baseDict){
        baseDictControllerApi.setCode(SHIPMENT_TYPE).setCode_name(SHIPMENT_NAME);
        return baseDictControllerApi.add(baseDict);
    }
    @RequestMapping("/edit")
    public ResultBean edit(BaseDict baseDict){
        baseDictControllerApi.setCode(SHIPMENT_TYPE);
        return baseDictControllerApi.edit(baseDict);
    }
    @RequestMapping("/delete")
    public ResultBean delete(String idsStr){
        return baseDictControllerApi.delete(idsStr);
    }
}
